package com.example.javafx.simple;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ColorPicker;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class ColorPickerExample extends Application {

    @Override
    public void start(Stage primaryStage) {
        // 创建 ColorPicker
        ColorPicker colorPicker = new ColorPicker();
        
        // 设置颜色选择事件处理器
        colorPicker.setOnAction(e -> {
            System.out.println("Selected Color: " + colorPicker.getValue());
        });

        // 创建布局并添加 ColorPicker
        VBox root = new VBox(colorPicker);
        Scene scene = new Scene(root, 300, 200);
        
        primaryStage.setTitle("ColorPicker Example");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}